﻿using System;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using System.Windows.Data;
using System.Linq;

namespace RestaurantBooker.Converters
{


    /// <summary>
    /// Converter for True => Visibility.Visible
    /// </summary>
    public class BoolInvertConverter : IValueConverter
    {
        public static bool GetValue(bool data)
        {
            return !data;
        }

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return GetValue((bool)value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return GetValue((bool)value);
        }
    }

    /// <summary>
    /// Converter for True => Visibility.Visible
    /// </summary>
    public class BoolToVisibilityConverter : IValueConverter
    {
        public static Visibility GetValue(bool data)
        {
            return data ? Visibility.Visible : Visibility.Collapsed;
        }

        public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            return GetValue((bool)value);
        }

        public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
        {
            Visibility visibility = (Visibility)value;
            return (visibility == Visibility.Visible);
        }
    }


    /// <summary>
    /// invert converter of True => Visibility.Collapsed
    /// </summary>
    //public class InvertVisibilityConverter : IValueConverter
    //{
    //    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    //    {
    //        bool boolVal = (bool)value;
    //        return !boolVal ? Visibility.Visible : Visibility.Collapsed;
    //    }

    //    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    //    {
    //        Visibility visibility = (Visibility)value;
    //        return (visibility == Visibility.Collapsed);
    //    }
    //}
}
